<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>  
    <script>
        function sum(num){
            if(num==1) return 1;

            return num + sum(num-1);
        }

        let sum1 = sum(100);
        console.log(sum1);
    </script>
</body>
</html>